Update robust glm notebook#3908
Update robust glm notebook#3908AlexAndorra merged 14 commits intopymc-devs:masterfrom jonsedar:update-robust-glm-notebook
Conversation
…to pass kwargs to the steppers I believe this fixes #3197 I also noted this need for more clarity in my updated notebook in this PR `pymc3/docs/source/notebooks/GLM-robust-with-outlier-detection.ipynb`
|
Check out this pull request on You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB. |
Codecov Report
@@ Coverage Diff @@
## master #3908 +/- ##
==========================================
+ Coverage 83.41% 83.45% +0.04%
==========================================
Files 103 103
Lines 14190 14178 -12
==========================================
- Hits 11836 11832 -4
+ Misses 2354 2346 -8
|
* remove file which is not used * remove deprecated code * repair tests and notebooks that used deprecated API * mention #3906 Co-authored-by: Michael Osthege <zufallsprinzip@hotmail.de>
* add deprecation warnings for old backends * mention backend deprecation #3902 * fix typo Co-authored-by: Colin <ColCarroll@users.noreply.github.com> Co-authored-by: Michael Osthege <zufallsprinzip@hotmail.de> Co-authored-by: Colin <ColCarroll@users.noreply.github.com>
|
Wow, this is an amazing improvement on an already amazing post. The one thing I want to make sure is that the headings are correct -- are section headings starting with |
notebook: dropped all headings one level lower to comply with TOC logic, and very minor language edits sampling.py: clarifired language around single vs compoundstep
|
Thanks for the feedback guys - I've tidied the notebook and clarified the docstring language in my latest commit |
|
Thanks Jon! I'm reviewing the NB right now -- will let you know when I'm done |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T14:30:41Z Can we skip displaying the yml file and substitute the watermark cell below? jonsedar commented on 2020-05-03T17:47:09Z Yep - removed. The important bits (python 3.6, pymc3 3.8) are already noted |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T14:30:42Z You don't need jonsedar commented on 2020-05-03T17:48:32Z probably worth keeping incase people run this in other IDEs (VSCode, PyCharm, Syder etc) I'm not sure how those work |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T14:30:43Z Can you tidy up the imports as follows:
In each layer, sort alphabetically. Here that would be: import warnings Also, you can use jonsedar commented on 2020-05-03T17:51:06Z Sure, done. |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T14:30:44Z This looks like a useless cell jonsedar commented on 2020-05-03T17:52:46Z Yeah, that can go - I tend to keep this around in my WIP templates as a location to abstract away long functions before they go to a source file
|
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T14:30:45Z Nice plot!
jonsedar commented on 2020-05-03T17:54:36Z ta :) though sometimes I really miss ggplot text_geom |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T14:30:46Z Typo: "... the same range and being more directly comparable..." jonsedar commented on 2020-05-03T17:56:03Z good catch |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T14:30:46Z
jonsedar commented on 2020-05-03T17:57:17Z Cool, will make a mental note to update this once that's out :)
I kept the defaults in since I think it can be useful to see them |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T14:30:47Z Very nice! For future reference, you can also use jonsedar commented on 2020-05-03T18:02:04Z Good to know - I'll definitely look out for that in future then: I find joint dists are massively helpful |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T14:30:48Z Same comments as other plot_trace |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T14:30:49Z Same comments as for other joint plot jonsedar commented on 2020-05-03T18:02:33Z Gotcha :) |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T14:30:50Z Here also you can use idata_i = az.from_pymc3(trace_i) # do that once, so that conversion to InferenceData happens only once; then use in every ArviZ function idata_d = az.from_pymc3(trace_d) jonsedar commented on 2020-05-03T18:11:11Z Thanks, I've made a note to come back update arvin throughout when available https://github.com/jonsedar/pymc3_examples/issues/15 |
|
Thanks Jon, this looks really nice and is a clear improvement over the old NB! I posted the first part of my review of your NB above, and I'll review the second part later this afternoon 😉 |
|
Thanks Alex, I'll wait for you to complete the review before I make any changes that you've suggested. Cheers, |
|
Yeah that'd be best if you can. I'm almost finished. |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T15:25:11Z Typo: "A Bernou jonsedar commented on 2020-05-03T18:12:09Z good catch |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-03T15:25:12Z Maybe you can quickly explain how you chose the jonsedar commented on 2020-05-03T18:35:14Z Fair point, added a note: testval for
The other testvals were set also in order to create asymmetry, but I've found they don't need it. Have reverted to mean values for b0, b1, y_est_out, sigma_y_out |
|
righto - I've logged a note to update these at some point :) https://github.com/jonsedar/pymc3_examples/issues/15 View entire conversation on ReviewNB |
|
Added to the list :) https://github.com/jonsedar/pymc3_examples/issues/15 View entire conversation on ReviewNB |
|
ah sweet typos... good catch, thanks! View entire conversation on ReviewNB |
…to pass kwargs to the steppers I believe this fixes #3197 I also noted this need for more clarity in my updated notebook in this PR `pymc3/docs/source/notebooks/GLM-robust-with-outlier-detection.ipynb`
notebook: dropped all headings one level lower to comply with TOC logic, and very minor language edits sampling.py: clarifired language around single vs compoundstep
…dar/pymc3 into update-robust-glm-notebook
upgrade to arviz=0.7 set prior params to slightly simpler (more justifiable) values, and testvals to simplier defaults explanatory clarifications formatting, typos,
|
okie dokie, I've addressed all @AlexAndorra's points - great review thank you - and I think this is ready to go One note: I did the olde: prior to my latest commit in this PR and see quite a few files changed in the meantime , must be a weekend with lots of folks working :) I don't see any clashes, but do let me know if you'd prefer a clean PR Cheers, Jon |
|
Hey, Jon. Looks great. Why is section 4.2.3 a markdown cell and not code? |
|
Thanks for the updates Jon! I'll review that tomorrow
Le dim. 3 mai 2020 à 21:20, Jonathan Sedar <notifications@github.com> a
écrit :
… okie dokie, I've addressed all @AlexAndorra
<https://github.com/AlexAndorra>'s points - great review thank you - and
I think this is ready to go
One note: I did the olde:
❯ git fetch upstream
❯ git rebase upstream/master
prior to my latest commit in this PR and see quite a few files changed in
the meantime , must be a weekend with lots of folks working :)
I don't see any clashes, but do let me know if you'd prefer a clean PR
Cheers, Jon
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3908 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHIJMTFA5ISJDKYS4S5MVTDRPW7XFANCNFSM4MX4IOIA>
.
|
Quite right - I'm an idiot! Will update now |
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-05-04T08:34:24Z Missed that yesterday, but just for future reference, here I think you could do this in one line with
|
AlexAndorra
left a comment
There was a problem hiding this comment.
Thanks for the updates Jon, this all looks good now! Just one last thing (sorry, forgot to tell you about it yesterday): could you please Black-format the NB with black_nbconvert?
That's what we use on the resources repo to standardize NBs: pip install black_nbconvert, then black_nbconvert /path/to/a/notebook.ipynb.
After that I'll merge 🍾
A lot of files have indeed been picked up by rebasing your branch. I don't know how you guys usually do, but I think it's no prb, as there is no conflicts and I'll squash & merge anyway.
|
Hi Alex, Good call re: https://github.com/dfm/black_nbconvert, that's a new one to me, ands no surprise to see it's by the ever-helpful & prolific DanFM! I've just run that reformatting and a re-run, all seems well, so will commit now |
|
Interesting test failure, if this requires underlying fixes to pymc3 let me know and perhaps for simplicity I can just make a new clean PR |
AlexAndorra
left a comment
There was a problem hiding this comment.
Thanks a lot Jon, this is all good now 👌
I'll merge as soon as tests pass -- this error is super weird BTW. It looks like pip couldn't install numpy. Do you have an idea how to fix that?
|
No idea - it could just have been a network hiccup at the time... For good measure I'll recommit and trigger again! |
|
It was a ghost in the machine :D |
|
Apparently 😅 |
|
Thanks for all your help and reviews! Will try to pick up some bugs next... BTW is there a protocol for deleting this branch on origin? |
|
Good question -- I'm not aware of any such protocol, but that'd be good practice |
The first purpose of this PR is to update the GLM robust regression notebook already in the examples here: https://docs.pymc.io/notebooks/GLM-robust-with-outlier-detection.html
Those updates are everything from v2.1 onwards:
Version history:
pm.Normal.dist().logp()andpm.Potential()nuin StudentT model to be more efficient, drop explicit use of theano shared vars, generally improve plotting / explanations / layoutThe second purpose of this PR is to clarify the docstring within
sampling.py, specifically the kwargs forstep_kwargswhen you have multiple steppers. I found the need for better clarity in the docstring during my rework of the notebook, so I hope it's valid to include a change in this single PR. I think this is also a fix for #3197